import { createApp } from 'vue';
import App from './App.vue';
import router from './router.js';
import { createPinia } from 'pinia';
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
import vuetify from "@/plugins/vuetify.js";
// --- ECharts 配置 ---
import ECharts from 'vue-echarts';
import { use } from 'echarts/core';
import { CanvasRenderer } from 'echarts/renderers';
import { BarChart } from 'echarts/charts';
import { GridComponent, TooltipComponent, TitleComponent } from 'echarts/components';
// 手动按需引入ECharts模块，减小打包体积
use([
    CanvasRenderer,
    BarChart,
    GridComponent,
    TooltipComponent,
    TitleComponent,
]);


const app = createApp(App);

// 初始化 Pinia
const pinia = createPinia();
pinia.use(piniaPluginPersistedstate); // 应用持久化插件
// 全局注册 VChart 组件.
app.component('v-chart', ECharts);

app.use(router)
    .use(vuetify)
    .use(pinia)

app.mount('#app');